package com.zqxq.lottery.api.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @Description ：
 * @Author ： 解风
 * @Date ： 2017/11/28 09:41
 */
@Configuration
public class ApiWebConfig extends WebMvcConfigurerAdapter {
    /**
     * 注册拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new ApiHandlerInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/v2/api-docs", "/swagger-resources/**","/static/**","/userAuth/**","/userOrder/**","/flowStep/**","/static/**","/jxlDotcraw/jxlAuth","/mq/**","/unSign/**"); // 排除拦截;
    }

    /**
     * 配置路径
     * @param configurer
     */
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        super.configurePathMatch(configurer);
        configurer.setUseSuffixPatternMatch(false);
    }
}
